<style>
.item-btn{text-align:center;padding-bottom:15px;}
.item-sbtn{padding:15px 35px 30px 35px;}
.item-sbtn .layui-btn{float: right;}
.item-sbtn .layui-form-label{width:auto;padding-left:0;}
.oshare_info{border: 3px dashed #E6E6E6;display:block;padding:20px 0;text-align:center;font-size:12px;color:#666}
.oshare_info a{color:#1284f6;text-decoration:underline;padding-right:10px}
.upbm_not .upbm_label{color:#999}
.upbm_not .layui-input-block{display:none;}
</style>
<form class="layui-form layui-font14" name="order" action="">
<input type="hidden" name="dispute_bh" value="{$data.number}">
<script type="text/javascript">
var maxnum=5,stop=1000,Rsdata;
$.getScript("/static/thinkct/js/plupload.js", function() {
//创建实例的构造方法
uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4', //上传插件初始化选用那种方式的优先级顺序
                browse_button: 'browse', // 上传按钮
                url: "/upload/", //上传地址
			    resize: {width: 900},  
				max_retries: 1,
                flash_swf_url: '/static/thinkct/js/Moxie.swf', //flash文件地址
                silverlight_xap_url: '/static/thinkct/js/Moxie.xap', //silverlight文件地址
                filters: {
					prevent_duplicates : true, //不允许队列中存在重复文件
                    max_file_size:'2mb', //最大上传文件大小（格式100b, 10kb, 10mb, 1gb）
                    mime_types: [
						//允许文件上传类型
                        {title: "图片文件", extensions:'jpg,png,gif'}
                    ]
                },
                multi_selection: true //true:ctrl多文件上传, false 单文件上传
	});
	uploader.init(); //初始化
		//绑定文件添加进队列事件

	uploader.bind('FilesAdded',function(uploader,files){
	var newnum=maxnum-parseInt($('.filelist div').length+$('#FileListing tr').length),flen=files.length,fhtml,vhtml='',ehtml='';
    // 最多上传newmaxnum
	if(flen>newnum){ 
	     layer.alert("<strong>凭证最多能上传"+maxnum+"张</strong>",{icon:2}); 
         uploader.splice(newnum,10000);  
        }
		for(var i = 0; i<=flen; i++){
			//更新UI
			if(i==flen){ 
			 if(ehtml!=''){layer.alert("<strong>以下凭证已传过了，不要重复上传</strong><br>"+ehtml,{icon:0});}
			 if(uploader.files.length>0){
			 $('#pluing').show();
			 $(fhtml).appendTo('#FileListing');
			 $('#pluing u').html(uploader.files.length);
			 }
			 return false;
			}
			// 最多上传newnum
			if(i>=newnum){ 
			continue;
		    }
			fname=files[i].name;
			fid=files[i].id;
			var f5name=$.md5(files[i].size+files[i].lastModifiedDate+files[i].type);
			 vhtml='<tr id="file-' + fid +'"><td>' + fname +'</td><td></td><td align="center"><a onclick=deling("'+fid+'")>取消</a></td></tr>'
			 $(".filelist :checkbox").each(function(){     
	         if($(this).val()==f5name){
             vhtml='';
			 uploader.removeFile(fid);
			 ehtml+="【"+fname+"】<br>";
			 return false;
			 }
	         });
             fhtml=fhtml+vhtml;	
		}

	});
	uploader.bind("BeforeUpload",function(uploader,file){
    uploader.setOption("multipart_params",{lastDate:file.lastModifiedDate,osize:file.size,number:'{$data.number}',filebh:'155006964878',type:'dispute',filetype:'files',maxnum:maxnum}); 
    }); 
	//进度
	uploader.bind("UploadProgress",function(uploader,file){
	$('#progress-in').width(uploader.total.percent+"%"); 
	$("#file-"+file.id+" td:eq(2)").html("<b>"+file.percent+"%</b>");
    });
	//上传完成后
	uploader.bind("FileUploaded",function(uploader, file,info){
		 $('#progress-uploaded').html(uploader.total.uploaded);
		 var data =$.parseJSON(info.response);
		 if(data.state!=0){
         $fh=$('#progress ul');
         $fh.show();
		 $('<p><span>'+file.name+'</span><br><b>'+data.state+' >> 继续执行…</b></p>').appendTo($fh);
	     stop=3000;
		 }
    });
	//全部完成后
	uploader.bind("UploadComplete",function(uploader){
		setTimeout("Rs(Rsdata)",stop);
    });
	//错误提示
	uploader.bind("Error",function(uploader,err){
		 if(err.message=='HTTP Error.'){
		 fid=err.file.id;
		 $("#file-"+fid+" td:eq(1)").html("<font color=red>系统出错，代码"+err.code+"</font>");
		 $("#file-"+fid+" td:eq(2)").html('<a onclick=deling("'+fid+'")>删除</a>');
		 return false;
		 }
		 layer.alert("<strong>"+err.message+"</strong>",{icon:5});
    });

});
</script>
<div class="notes">
<li><h3>小提示：</h3></li>

	<li><b>1.</b>拒绝退款原因最多可以补充<strong class="green"> {$supplement} </strong>次，您当前已补充<strong class="blue"> {$count} </strong>次;</li>
	<li><b>2.</b>补充的原因请尽量与买家前面申请退款的原因相对应。</li>
</div>
<div class="layui-form-item">
<div class="upload-box" style="margin:0 15px">
<p>
<textarea name="txt" class="layui-textarea" lay-verify="reason_txt" style="height:100px;width:96%;margin:10px 2% 0 2%" placeholder="请详细说明拒绝退款原因，不能少于10个字！"></textarea>
</p>

	<div class="container">
				<div class="statusBar" style="line-height:36px;">
				<div class="info"><b>1.</b>凭证非必传！限传5个,单个大小限2M，JPG/GIF/PNG格式</div>
					<div class="btns">
					<a id="browse" style="position: relative; z-index: 1;">上传凭证</a>
					<div id="html5_1decnmjft1qdp1n671jj81aslbu63_container" class="moxie-shim moxie-shim-html5" style="position: absolute; top: 0px; left: 0px; width: 94px; height: 32px; overflow: hidden; z-index: 0;"><input id="html5_1decnmjft1qdp1n671jj81aslbu63" type="file" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" multiple="" accept="image/jpeg,image/png,image/gif"></div></div>
				</div>
<table class="fu_list" id="pluing" style="display:none;">
            <thead>
              <tr>
                <td width="65%">待传队列（<u>0</u>）</td>
				<td width="25%" align="center"></td>
                <td width="10%" align="center">操作</td>
              </tr>
            </thead>
            <tbody id="FileListing">
            </tbody>
          </table>
	</div>
</div>
</div>
<div class="layui-form-item item-btn">
<input type="button" class="layui-btn layui-btn-danger lay-submit" lay-submit="" lay-filter="main" value="拒绝退款">
</div>
<input type="hidden" name="layer" value="1">
<input type="hidden" name="role" value="sell">
<input type="hidden" name="utime" value="">
<input type="hidden" name="action" value="refuse_back">
<input type="hidden" name="number" value="{$data.number}">
</form>
<script type="text/javascript">
var zindex=parent.layer.zIndex;//当前层INDEX
layer.title('<font color=red style="font-weight:700;font-size:14px;">补充拒绝原因</font>');
 layui.use('form', function(){
 var form = layui.form();
 form.verify({
	 	reason_txt: function(value) {
			if($.trim(value).length<10)  return '原因不能少于10个字！';
		}
		,backmoney: function(value) {
			if($("input[name=backtype]:checked").val() == 'part'){
				if(isNaN(value)) return '【部分退款】额度有误，请重新输入！';
				if(value>10.00) return '【部分退款】额度必须小于交易额：10';
				if(value<=0) return '【部分退款】额度必须大于0';
			}
			if($("input[name=upbm]:checked").val()==1){
				if($("input[name=backtype]:checked").val() == 'part'){
					if(value*1==0) return '退款金额没有任何改动<br>若不修改请不要勾选【修改退款金额】';
				}else{
					if(0==0) return '退款金额没有任何改动<br>若不修改请不要勾选【修改退款金额】';	 
				}
			}
		}

});
form.on('submit(main)', function(data) {
layer.confirm("确定要提交<b class=red> 不同意退款 </b>吗？",{icon:3}, function(index){
	layer.load();
	dform(data.field,'order',function(datas){
		if(datas.state==1 && uploader.total.queued>0){
			Rsdata=datas;
			progress();
			$('#progress-upload').html(uploader.total.queued);
			uploader.start();
		}else{
			Rs(datas);
		}
	});
});
return false;
});

form.on('checkbox(upbm)',function(data){
		var $div=$(data.elem).closest(".layui-form-item");
		if(data.elem.checked){
			$div.removeClass("upbm_not");
			$('.layui-textarea').attr('placeholder','请说明修改退款金额原因，不能少于10个字！');
			$('.lay-submit').val('确认修改');
		}else{
			$div.addClass("upbm_not");
			$('.layui-textarea').attr('placeholder','请说明申请退款原因，不能少于10个字！');
			$('.lay-submit').val('确认补充');
		}
});

form.on('radio(backtype)',function(data){
		var $div=$(data.elem).closest(".layui-form-item").find('.backmoney_box');
		if(data.elem.value=='part'){
			$div.show();
		}else{
			$div.hide();
		}
});
form.on('radio(cashed_type)',function(data){
	    $('.layui-btn-cashed').val($(data.elem).data('title'));
	    $('.cashed_box').hide();
		$('.cashed_box_'+data.value).show();
});

form.on('select(main_reason)',function(data){
		$(data.elem).closest(".layui-form-item").find('.layui-form-mid').html(data.elem.value=='网盘失效'?'注：如果您不需要了，请在下方明确告知卖家不要再发货！':'');
});

	form.render(); //更新全部
$('.upbm_label').click(function(){$(this).prev().click();form.render('checkbox')});
});
 document.onkeydown = function(event) {
        var target, code, tag;
        if (!event) {
            event = window.event; //针对ie浏览器
            target = event.srcElement;
            code = event.keyCode;
            if (code == 13) {
                tag = target.tagName;
                if (tag == "TEXTAREA") { return true; }
                else { return false; }
            }
        }
        else {
            target = event.target; //针对遵循w3c标准的浏览器，如Firefox
            code = event.keyCode;
            if (code == 13) {
                tag = target.tagName;
                if (tag == "INPUT") { return false; }
                else { return true; }
            }
        }
    };
if(typeof revise_money == 'function') revise_money();

</script>